﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid;
using GeneralDFS.Client;
using GeneralDFS.DataEntity.IO;

namespace DXWinFormDataAnalysis
{
    public partial class FileExplorer : DevExpress.XtraEditors.XtraForm
    {
        private Client _client;

        public FileExplorer()
        {
            InitializeComponent();
            _client=new Client();
            txtPath.Text = "";
        }

        public void RefreashData()
        {
            var remoteObject = _client.GetRemoteObjectDirect(txtPath.Text);
            var node = remoteObject.GetNodeByPath(txtPath.Text);
            if (node.IsDirectory())
            {
                gridControl1.BeginUpdate();
                gridControl1.DataSource = ((DirectoryNodeInfo)node).Childs;
                gridControl1.EndUpdate();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            RefreashData();
        }
    }
}